import {createRouter, createWebHashHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    // linkActiveClass: 'aa', , .router-link-active 在router-link 模板中 定义.aa样式类
    // linkExactActiveClass: 'aa', .router-link-exact-active
    routes: [
        {
            path: '/',
            name: 'home',
            component: HomeView
        },
        {
            path: '/names',
            name: 'na',
            alias: ['/n1', '/n2', '/n3'],
            component: () => import('@/views/names.vue'),
        },
        {
            //path: '/ss/:scores+', /ss/10/20/30
            path: '/ss/:scores(\\d+)+', // ss/10/20/30/40/50
            component: () => import('@/views/score.vue')
        }
        ,
        {
            path: '/sets/:id(\\d+)?',
            name: 'sets', //命名路由
            alias: ['/aa/:id(\\d+)?', '/bb', '/cc'], //别名，本质是path的别名
            component: () => import('@/views/sets.vue')
        },
        {
            path: '/about',
            name: 'about',
            // route level code-splitting
            // this generates a separate chunk (About.[hash].js) for this route
            // which is lazy-loaded when the route is visited.
            component: () => import('../views/AboutView.vue')
        },
        {
            path: '/:catchAll(.*)',
            name: 'notfound',
            component: () => import('@/views/view404.vue'),
        }
    ]
})

export default router
